$(document).ready(function() {
    $(".main-menu").click(function() {
        if ($(this).parent().hasClass("clicked-admin-menu")) {
            $(this).parent().removeClass("clicked-admin-menu");
        } else {
            $(this).parent().addClass("clicked-admin-menu");
        }
    });

    $("#master_check").click(function(event){
        var target = event.target;
        $("#tbl_list").find("input[type='checkbox']").each(function(){
            $(this).prop("checked", $(target).prop("checked"));
        });
    });
    
    $("#frm_search_user").submit(function() {
        var search_name = $("#search_name").val();
        var redirect_url = base_url + "/admin/index/users";
        if (search_name !== '') {
            redirect_url += "/search_name/" + search_name;
        }
        window.location.href = redirect_url;
        return false;
    });
    
});